<template>
    <UxDialog :visible="!!dialog_leave" @close="dialog_leave = null">

        <div class="dialog-leave">
            <figure>
                <img src="@/assets/images/designer/dialog-leave.png" alt="">
            </figure>
            <p>
                <strong>Are you sure you want to leave the current page?</strong>
                <span>If you leave now, your changes will be lost</span>
            </p>

            <fieldset>
                <button @click="dialog_leave = null" type="primary">Cancel</button>
                <button @click="dialog_leave()">Leave</button>
            </fieldset>
        </div>
    </UxDialog>
</template>
<script>
export default {
    data () {
        return {
            dialog_leave: null,
        };
    },
    methods: {
        check (callback) {
            this.dialog_leave = () => {
                this.dialog_leave = null;
                callback()
            }
        }
    },
};
</script>
<style lang="scss" scoped>
.dialog-leave {
    width: 320px;
    height: 414px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 56px 14px 14px;

    figure {
        width: 80px;
        height: 80px;
        img,
        svg {
            width: 100%;
            height: 100%;
        }
    }

    p {
        flex: 1;
        margin-top: 36px;
        display: flex;
        flex-direction: column;
        text-align: center;
        strong {
            font-size: 16px;
            font-family: Roboto-Regular, Roboto;
            font-weight: 400;
            color: #000000;
            line-height: 22px;
        }
        span {
            margin-top: 10px;
            font-size: 14px;
            font-family: Roboto-Regular, Roboto;
            font-weight: 400;
            color: #000000;
            line-height: 22px;
        }
    }

    fieldset {
        display: flex;
        flex-direction: column;
        width: 100%;

        button {
            height: 38px;
        }
        button + button {
            margin-top: 8px;
        }
    }
}
</style>
